package ru.gerunn.study.strings;

public class Internation {

	public static void main(String[] args) {

		String a = "a";
		String b = "a";
		String c = new String("a");

		System.out.println("using constants:");
		System.out.println("'a' == 'a': " + ("a" == "a"));

		System.out.println("using variables:");
		System.out.println("a: '" + a + "'");
		System.out.println("b: '" + b + "'");
		System.out.println("c: '" + c + "'");

		System.out.println("before intern:");
		System.out.println("a == b: " + (a == b));
		System.out.println("b == c: " + (b == c));
		System.out.println("a == c: " + (a == c));

		c = c.intern();

		System.out.println("after intern:");
		System.out.println("a == b: " + (a == b));
		System.out.println("b == c: " + (b == c));
		System.out.println("a == c: " + (a == c));

	}

}
